package com.daiyang.testdemo.controller;

import com.daiyang.testdemo.model.Preson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.SortedMap;

@RequestMapping("/hello")
@Controller
@ResponseBody
public class UserController {
   // @RequestMapping(value = "/sayhi",method = RequestMethod.GET)
    @GetMapping("/sayHi")
    public String sayHi() {
        return "hi";
    }
   // @ResponseBody
    @GetMapping("/param")
    public String param(  String name) {
        System.out.println(1);
        return "参数名称："+name;
    }
    @GetMapping("/param2")
    public String param2( String name, Integer age) {
        return "参数名称："+name+age;
    }
    @GetMapping("/param3")
    public Preson param2(Preson preson) {
        return preson;
    }
    @GetMapping("/param4")
    public String Arrays( @RequestParam (required = false) String[] arr) {
        return Arrays.toString(arr);
    }
    @GetMapping("param5")
    public String Arrays2(@RequestParam List<String> list ) {
        return list.toString();
    }

  //  @ResponseBody
    @GetMapping("/param6")
    public String Arrays3(@RequestBody  Preson preson) {
        System.out.println(111);
        return preson.toString();
    }

}
